//
//  LevenoComputerBuilder.m
//  ArchitectDemo
//
//  Created by 姚胜龙 on 2017/7/5.
//  Copyright © 2017年 姚胜龙. All rights reserved.
//

#import "LevenoComputerBuilder.h"
#import "LevenoComputer.h"

@interface LevenoComputerBuilder ()
@property (nonatomic, strong) id<IComputer> computer;
@end

@implementation LevenoComputerBuilder

- (instancetype)init
{
    self = [super init];
    if (self) {
        _computer = [[LevenoComputer alloc] init];
    }
    return self;
}

//构建CPU
- (id<IComputerBuilder>)buildCPU:(NSString *)cpu {
    [_computer cpu:cpu];
    return self;
}
//构建显卡
- (id<IComputerBuilder>)buildDisplay:(NSString *)display {
    [_computer display:display];
    return self;
}
//构建主板
- (id<IComputerBuilder>)buildMainboard:(NSString *)mainboard {
    [_computer mainboard:mainboard];
    return self;
}
//构建系统
- (id<IComputerBuilder>)buildOS:(NSString *)os {
    [_computer os];
    return self;
}
//构建
- (id<IComputer>)build {
    NSLog(@"构建了一台Leveno💻");
    //正式的项目中其实这里有很多的逻辑
    return _computer;
}

@end
